package tabdulin.sms.megafon;

import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit.ParserCallback;

/**
 * @author Talgat Abdulin
 *
 */
public class MegafonStatusSeeeker extends ParserCallback {
	private String statusLink;
	
	public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributes, int position) {
		if (tag != HTML.Tag.A) {
			return;
		}
		if (attributes.getAttributeCount() == 0) {
			return;
		}
		String id = (String) attributes.getAttribute(HTML.Attribute.ID);
		if (id == null) {
			return;
		}
		if (id.compareTo("link-check-status") != 0) {
			return;
		}
		this.statusLink = (String) attributes.getAttribute(HTML.Attribute.HREF);
	}

	public String getStatusLink() {
		return statusLink;
	}
}
